package com.nuonuo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author duan
 * @version 1.0
 * @date 2023/1/11 9:53
 */
@RestController
@RequestMapping(value = "/")
public class HelloController {

    private static final Logger LOGGER = LoggerFactory.getLogger(HelloController.class);

    private int TIMES = 0;

    @RequestMapping(value = "/")
    public String sayHello1() {
        return "hello";
    }

    @RequestMapping(value = "sayHello")
    public String sayHello() {
        return "hello";
    }

    @RequestMapping(value = "sayHi")
    public String sayHi() {
        return "hi";
    }

    @RequestMapping(value = "sayGood")
    public String sayGood() {
        return "good";
    }

    @GetMapping(value = "/html/sayHello")
    public String htmlSayHello(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/aa/bb/sayHello")
    public String aaBbSayHello(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/prefix/sayHello")
    public String prefixSayHello(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/exact/sayHello")
    public String exact(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/max-prefix/sayHello")
    public String maxPrefix(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/aa/bb/regex-suffix")
    public String aaBbRegexSuffix(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/max-prefix/regex-suffix")
    public String regexSuffix(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/test/regex-suffix")
    public String testSuffix(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/test2/regex-suffix")
    public String test2Suffix(HttpServletRequest request) {
        return request.getRequestURI();
    }

    @GetMapping(value = "/v5/sayHello")
    public String say() {
        return "/";
    }


    @GetMapping(value = "/v5_4/sayHello")
    public String say4() {
        return "/";
    }

//    @GetMapping(value = "/api/1.jpg")
//    public String say2() {
//        return "/";
//    }
//
//    @GetMapping(value = "v1/sayHello")
//    public String sayHello1() {
//        return "/v1/sayHello";
//    }
//
//    @GetMapping(value = "v1_1/sayHello")
//    public String sayHello1_1() {
//        return "/v1_1/sayHello";
//    }
//
//    @GetMapping(value = "v2/sayHello")
//    public String sayHello2() {
//        return "/v2/sayHello";
//    }
//
//    @GetMapping(value = "v2_1/sayHello")
//    public String sayHello2_1() {
//        return "/v2_1/sayHello";
//    }
//
//    @GetMapping(value = "api/sayHello")
//    public String apiSayHello1() {
//        return "api/sayHello";
//    }
//
//
//    @GetMapping(value = "apisayHello")
//    public String apiSayHello2() {
//        return "apisayHello";
//    }
//    @GetMapping(value = "v3/api/sayHello")
//    public String sayHello3() {
//        return "/v3/api/sayHello";
//    }
//
//    @GetMapping(value = "v3_1/api/sayHello")
//    public String sayHello3_1() {
//        return "/v3_1/api/sayHello";
//    }
//
//    @GetMapping(value = "v4/api/sayHello")
//    public String sayHello4() {
//        return "v4/api/sayHello";
//    }
//
//    @GetMapping(value = "v4_1/api/sayHello")
//    public String sayHello4_1() {
//        return "v4_1/api/sayHello";
//    }
}
